e32f66
@@ -483,12 +483,6 @@
public static boolean cannotConvert(long aliasKnownSize,
         if (!bigTableCandidates.contains(pos)) {
           continue;
         }
-        // deep copy a new mapred work from xml
-        // Once HIVE-4396 is in, it would be faster to use a cheaper method to clone the plan
-        MapredWork newWork = SerializationUtilities.clonePlan(currTask.getWork());
-
-        // create map join task and set big table as i
-        MapRedTask newTask = convertTaskToMapJoinTask(newWork, pos);
 
         Operator<?> startOp = joinOp.getParentOperators().get(pos);
         Set<String> aliases = GenMapRedUtils.findAliases(currWork, startOp);
@@ -498,6 +492,11 @@
public static boolean cannotConvert(long aliasKnownSize,
           continue;
         }
 
+        MapredWork newWork = SerializationUtilities.clonePlan(currTask.getWork());
+
+        // create map join task and set big table as i
+        MapRedTask newTask = convertTaskToMapJoinTask(newWork, pos);
+
         // add into conditional task
         listWorks.add(newTask.getWork());
         listTasks.add(newTask);
@@ -515,6 +514,10 @@
public static boolean cannotConvert(long aliasKnownSize,
       throw new SemanticException("Generate Map Join Task Error: " + e.getMessage(), e);
     }
 
+    if (listTasks.isEmpty()) {
+      return currTask;
+    }
+
     // insert current common join task to conditional task
     listWorks.add(currTask.getWork());
     listTasks.add(currTask);
